<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        .container {
            position: relative;
        }

        nav {
            position: absolute;
            background: red;
            left: 0px;
            width: 200px;
        }

        section {
            /* position is static by default */
            margin-left: 200px;
        }

        section.section1 {
            background: green;
        }

        section.section2 {
            background: blue;
        }

        footer {
            /*background: red;*/
            position: fixed;
            border: 1px solid red;
            bottom: 0;
            left: 0;
            height: 70px;
            width: 100%;
        }

        body {
            margin-bottom: 120px;
        }
    </style>
</head>
<body>
<div class="container">
    <nav>
        <ul>
            <li>a</li>
            <li>a</li>
            <li>a</li>
            <li>a</li>
        </ul>
    </nav>
    <section class="section1">section s的 margin-left 样式确保了有足够的空间容纳 nav 元素。</section>
    <section class="section2">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et
        dictum interdum,
        nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue
        eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Mauris ante ligula, facilisis sed ornare eu,
        lobortis in odio. Praesent convallis urna a lacus interdum ut hendrerit risus congue. Nunc sagittis dictum nisi,
        sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui
        eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor
        porta. Cras ac leo purus. Mauris quis diam velit.
    </section>
</div>
<footer>如果你使用了一个固定定位的页眉或页脚，确保有足够的空间来显示它们！我在 body 上面加了 margin-bottom 。</footer>
</body>
</html>